package jfprincesstests.fakes;

import jfuzzyprincepless.agents.BaseNegotiationAgent;
import jfuzzyprincepless.negotiation.INegotiationContext;
import jfuzzyprincepless.algorithm.structure.services.IWhileService;

public class FakeWhileAgent extends BaseNegotiationAgent {
	private String name;
	private StringBuilder sb;

	public FakeWhileAgent(String name, StringBuilder sb) {
		this.name = name;
		this.sb = sb;
	}

	@Override
	public boolean negotiate(INegotiationContext context) {
		sb.append(sb.length() == 0 ? "" : ", ").append(name);
		IWhileService whileServ = context.getService(IWhileService.class);
		return whileServ.isAgentAlive(this);
	}
}
